<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of UserException
 *
 * @author Administrator
 */

namespace frontend\exception;

class UserException extends \LogicException {

    //put your code here
    const E_UNKNOW_LOGIN_TYPE = 403; /* 未知登陆类型 */
    const E_USER_NOT_RESIGTER = 404; /* 用户未注册 */
    const E_USER_INFO_EXECPTION = 405; /* 用户数据异常 */
    const E_USER_HAS_LOGIN = 406; /* 用户已登录 */
    const E_USER_PASSWORD_ERROR = 407; /* 密码错误 */
    const E_USERNAME_TOOSHORT_ERROR = 408; /* 用户名至少2个字,请重新修改 */
    const E_USERNAME_TOOLONG_ERROR = 409; /* 用户名至少2个字,请重新修改 */
    const E_DATABASE_INSERT_ERROR = 501; /* 用户数据插入错误 */
    const E_OAUTH_TOKEN_INVAILD = 503;
    const E_OAUTH_UID_INVAILD = 504;
    const E_OAUTH_TYPE_UNSUPPORT = 505;

    static $codeMessage = array(
        403 => '未知登陆类型',
        404 => '用户未注册',
        405 => '用户数据异常',
        406 => '用户已登录',
        407 => '密码错误,请重新输入',
        408 => '用户名至少2个字,请重新修改',
        409 => '用户名至多15个字,请重新修改',
        411 => '会话已过期,请重新登录',
        412 => '用户不是会员',
        421 => '用户名重复',
        422 => '未知性别',
        423 => '上传错误',
        424 => '个性签名格式错误',
        425 => '用户名有特殊字符,请重新修改',
        426 => '用户已注册',
        503 => '第三方令牌失效',
        504 => '第三方令牌id不对',
    );

    public function __construct($code = 0, \Exception $previous = null) {
        parent::__construct(self::$codeMessage[$code], $code, $previous);
    }

}
